{include file="public/_meta" title="修改菜单栏目"/}
<article class="page-container">
	<form action="" method="get" class="form form-horizontal" id="form-edit_menu_list">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">
				<span class="c-red">*</span>
				上级目录：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select class="select" id="pid" name="pid">
					<option value="0">顶级目录</option>
					{volist name="listTree" id="vo"}
					<option {if condition="$vo['level'] eq 1 OR $list['pid'] eq 0"} disabled="disabled" {/if} {if condition="$list['pid'] eq $vo.id"} selected="selected" {/if} value="{$vo.id}"><?php echo str_repeat('&nbsp;',$vo['level']*6)?>{$vo.list_name}</option>
					{/volist}
				</select>
				</span>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">
				<span class="c-red">*</span>
				目录名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="hidden" class="input-text" value="{$list.id}" placeholder="" id="list_id" name="id">
				<input type="text" class="input-text" value="{$list.list_name}" placeholder="" id="list_name" name="list_name">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">
				<span class="c-red">*</span>
				模块名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$list.module}" placeholder="请输入模块名称"  name="module">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">
				<span class="c-red">*</span>
				控制器名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$list.controller}" placeholder="注：控制器请使用驼峰，如：TestType"  name="controller">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div id="function" class="row cl">
			<label class="form-label col-xs-4 col-sm-3">
				<span class="c-red">*</span>
				方法名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$list.function}" placeholder="请输入方法名称"  name="function">
			</div>
			<div class="col-3">
			</div>
		</div>
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">
				<span class="c-red">*</span>
				目录url地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$list.frame_url}" placeholder="请输入二级目录地址如：index/index" id="frame_url" name="frame_url">
			</div>
			<div class="col-3">
			</div>
		</div>-->
		<div id="list_icon" class="row cl">
			<label class="form-label col-xs-4 col-sm-3">目录icon图标：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input style="padding-left:5px;width:200px;border: 1px solid #ddd;height:31px;" type="text" value="{$list._icon}" placeholder="请输入icon图标符合" name="list_icon">&nbsp;
				<i id="icon_display" style="padding-right:5px;font-size:31px;" class="Hui-iconfont" title="查看icon">{$list.list_icon}</i><a href="javascript:void(0);" onclick="icon_list('点击选择icon','{:url(\'System/icon\')}','800','400')" class="btn btn-primary size-M radius">点击选择icon</a>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div id="select_icon"  class="row cl">
			<label class="form-label col-xs-4 col-sm-3">下拉icon图标：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-3">
				<input class="btn btn-primary radius" type="submit" value="提交">
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn-success size-M radius" type="button">取消</button>
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer" /}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">
    /*icon图标页面*/
    function icon_list(title,url,w,h){
        layer_show(title,url,w,h);
    }

	//加载时
	$(function(){
        //选中的值
        var option = $('.select option:selected').val();
        if(option != 0){
            $('#list_icon').remove();
            $('#select_icon').remove();
		}/*else if(option == 0){
            $('#function').after('<div id="list_icon" class="row cl">' + '<label class="form-label col-xs-4 col-sm-3">目录icon图标：</label>' + '<div class="formControls col-xs-8 col-sm-9">' + '<input style="padding-left:5px;width:200px;border: 1px solid #ddd;height:31px;" type="text" value="{$list.list_icon}" placeholder="请输入icon图标符合" name="list_icon">'+ '&nbsp;'+ '<i id="icon_display" style="padding-right:5px;font-size:31px;" class="Hui-iconfont" title="查看icon">{$list.list_icon}</i><a href="javascript:void(0);" onclick="icon_list(\'点击选择icon\',\'{:url(\'System/icon\')}\',\'800\',\'400\')" class="btn btn-primary size-M radius">点击选择icon</a>' + '</div>' + '<div class="col-3">' + '</div>' + '</div>' + '<div id="select_icon"  class="row cl">' + '<label class="form-label col-xs-4 col-sm-3">下拉icon图标：</label>' + '<div class="formControls col-xs-8 col-sm-9">' + '<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i>' + '</div>' + '<div class="col-3">' + '</div>' + '</div>');
        }*/
    });

    //选中的值改变时
    $('.select').change(function(){
        //选中的值
        option = $('#pid').val();
        if(option != 0){
            $('#list_icon').remove();
            $('#select_icon').remove();
        }else if(option == 0){
            $('#function').after('<div id="list_icon" class="row cl">' + '<label class="form-label col-xs-4 col-sm-3">目录icon图标：</label>' + '<div class="formControls col-xs-8 col-sm-9">' + '<input style="padding-left:5px;width:200px;border: 1px solid #ddd;height:31px;" type="text" value="{$list._icon}" placeholder="请输入icon图标符合" name="list_icon">'+ '&nbsp;'+ '<i id="icon_display" style="padding-right:5px;font-size:31px;" class="Hui-iconfont" title="查看icon">{$list.list_icon}</i><a href="javascript:void(0);" onclick="icon_list(\'点击选择icon\',\'{:url(\'System/icon\')}\',\'800\',\'400\')" class="btn btn-primary size-M radius">点击选择icon</a>' + '</div>' + '<div class="col-3">' + '</div>' + '</div>' + '<div id="select_icon"  class="row cl">' + '<label class="form-label col-xs-4 col-sm-3">下拉icon图标：</label>' + '<div class="formControls col-xs-8 col-sm-9">' + '<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i>' + '</div>' + '<div class="col-3">' + '</div>' + '</div>');
        }
    });

	$("#form-edit_menu_list").validate({
		rules:{

		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var data = $(form).serializeArray();
			$(form).ajaxSubmit({
				url : "{:url('system/edit_menu_list')}",
				type : 'get',
				dataType : 'json',
				data : data,
				async : false,
				success : function(msg){
					if(msg.status == true){
						layer.msg(msg.message,{icon: 6,time:1000});
						setTimeout(jump,1000);
						function jump(){
							parent.location.reload();
						}
					}else if(msg.status == false){
						layer.msg(msg.message,{icon: 5,time:1000});
					}else{
						layer.msg(data,{icon: 5,time:1000});
					}
				}
			});
			//var index = parent.layer.getFrameIndex(window.name);
		}
	});
</script>
<!--/请在上方写此页面业务相关的脚本-->
